// * 设备管理模块
import { SchemaItem } from "@/components/JsonSchemaForm/interface";
import { ReqPage } from "./index";
export enum GatewayType {
	Device = "device",
	Gateway = "gateway",
	Product = "product",
	SoftGateway = "soft_gateway",
	SS10XGateway = "ss10x_gateway",
	HmpGateway = "ssiot-gw-hmp"
}
export enum ProductModel {
	Hmp = "HmpProduct"
}

export namespace Device {
	/********** 请求参数 **********/
	//查询设备
	export interface ReqDeviceParam {
		idSn?: string;
		[key: string]: any;
	}

	//查询网关
	export interface ReqGateway {
		idSn?: string;
		[key: string]: any;
	}
	//查询数据
	export interface ReqFindData {
		pageIndex?: number;
		pageSize?: number;
		idSn: string;
		key: string;
		keyType: "sensor" | "system";
		startTime?: string;
		endTime?: string;
		timeOrder?: string;
		productModel?: string;
	}

	/********** 请求响应 **********/
	//查询产品
	export interface ReqProduct {
		idSn?: string;
		[key: string]: any;
	}
	export interface ResDeviceInfo {
		id: string;
		sn: string;
		name: string;
		deptId: string;
		deptName: string;
		onlineStatus: string;
		type: string;
		productModel: string;
		gatewaySn: string;
		alarmStatus: boolean;
		location: any;
		createTime: string;
		updateTime: string;
		lastLiveTime: string;
		registerTime: string;
		logoutTime: string;
		/**
		 * view={
		 * 	page:{
		 * 		page1:{url:'page1'},
		 *  	page2:{url:'page2'}
		 * 	},
		 * 	topo:{
		 * 		topo1:{url:'topo1'},
		 * 		topo2:{url:'topo2'}
		 * 	}
		 * }
		 */
		variableList?: any[];
		view: {
			curr?: string;
			page?: { url?: string; topoId?: string }[];
			topo?: { url?: string; topoId?: string }[];
		};
	}

	//查询网关的后台返回
	export interface ResGateway {
		id: string;
		[key: string]: any;
	}
	export interface ResDataInfo {
		devSn: string;
		updateTime: string;
		value: any;
	}

	//查询网关的后台返回
	export interface ResProduct {
		/**
		 * view={
		 * 	page:{
		 * 		page1:{url:'page1'},
		 *  	page2:{url:'page2'}
		 * 	},
		 * 	topo:{
		 * 		topo1:{url:'topo1'},
		 * 		topo2:{url:'topo2'}
		 * 	}
		 * }
		 */
		view?: {
			curr?: string;
			page?: { url?: string; topoId?: string }[];
			topo?: { url?: string; topoId?: string }[];
			custom?: { url?: string };
		};
		[key: string]: any;
	}

	export interface ReqRule {
		id?: string;
		[key: string]: any;
	}
	export interface ResRule {
		id: string;
		[key: string]: any;
	}
}
export namespace Forward {
	export interface ReqServer {
		id?: string;
		[key: string]: any;
	}
	export interface ResServer {
		id: string;
		[key: string]: any;
	}

	export interface ReqRule {
		id?: string;
		[key: string]: any;
	}
	export interface ResRule {
		id: string;
		[key: string]: any;
	}

	export interface ReqPlugin {
		id?: string;
		[key: string]: any;
	}
	export interface ResPlugin {
		id: string;
		[key: string]: any;
	}
}

export namespace Applet {
	export interface ReqUserApplet {
		id?: string;
		[key: string]: any;
	}
	export interface ResUserApplet {
		id: string;
		home?: string;
		key: string;
		instanceId?: string;
		[key: string]: any;
	}

	export interface ReqApplet {
		id?: string;
		[key: string]: any;
	}
	export interface ResApplet {
		id: string;
		[key: string]: any;
	}
}
export namespace System {
	export interface ReqDict {
		id?: string;
		[key: string]: any;
	}
	export interface ResDict {
		id?: string;
		[key: string]: any;
	}

	export interface ReqDictType {
		id?: string;
		[key: string]: any;
	}
	export interface ResDictType {
		id?: string;
		[key: string]: any;
	}
	export interface ReqServer {
		id?: string;
		[key: string]: any;
	}
	export interface ResServer {
		id?: string;
		[key: string]: any;
	}
	export interface ReqLogger {
		id?: string;
		[key: string]: any;
	}
	export interface ResLogger {
		id?: string;
		[key: string]: any;
	}
}
export namespace Schema {
	export interface ResSchemaInfo {
		schema: SchemaItem;
		[key: string]: any;
	}
	export interface ResProfileInfo {
		[key: string]: any;
	}
}

/**
 * 变量管理
 */
export namespace Variable {
	export interface ReqVariable extends ReqPage {
		[key: string]: any;
	}
	export interface ResVariable {
		id?: string;
		sn?: string;
		key: string;
		label?: string;
		type?: string;
		value?: string | number | boolean | undefined | object;
		config?: { [key: string]: any };
		param?: { [key: string]: any };
		reportTime?: string;
		updateTime?: string;
		devName?: string;
		devType?: string;
		deptId?: string;
		deptName?: string;
		assDict?: string;
		copy?: boolean;
		data?: object;
		confDel?: string;
		// [key: string]: any;
	}
	export interface DelVariable {
		snKey: { [key: string]: string[] };
		[key: string]: any;
	}
}

export namespace Report {
	export interface StatDataInfo {
		time: string;
		value: any;
		title: string;
		sn: string;
		name: string;
		location: string;
	}
}
